package com.service.hibernate.pojos;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.service.hibernate.pojos.ServicesUses.ServicesUses;

@SuppressWarnings("serial")
@Entity
@Table(name = "stocks")
public class Stocks implements Serializable {

	private int item_id;
	private String name;
	private String description;
	private float unit_price_sel;
	private float unit_price_buy;
	private float quantity;

	private List<ServicesUses> services = new ArrayList<ServicesUses>();

	public Stocks() {
	}

	public Stocks(int item_id, String name, String description,
			float unit_price_sel, float unit_price_buy, float quantity) {
		this.item_id = item_id;
		this.name = name;
		this.description = description;
		this.unit_price_sel = unit_price_sel;
		this.unit_price_buy = unit_price_buy;
		this.quantity = quantity;
	}

	public Stocks(int item_id, String name, String description,
			float unit_price_sel, float unit_price_buy, float quantity,
			List<ServicesUses> services) {
		super();
		this.item_id = item_id;
		this.name = name;
		this.description = description;
		this.unit_price_sel = unit_price_sel;
		this.unit_price_buy = unit_price_buy;
		this.quantity = quantity;
		this.services = services;
	}

	@Id
	@GeneratedValue
	@Column(name = "item_id")
	public int getItem_id() {
		return item_id;
	}

	public void setItem_id(int item_id) {
		this.item_id = item_id;
	}

	@Column(name = "name")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "description")
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "unit_price_sel")
	public float getUnit_price_sel() {
		return unit_price_sel;
	}

	public void setUnit_price_sel(float unit_price_sel) {
		this.unit_price_sel = unit_price_sel;
	}

	@Column(name = "unit_price_buy")
	public float getUnit_price_buy() {
		return unit_price_buy;
	}

	public void setUnit_price_buy(float unit_price_buy) {
		this.unit_price_buy = unit_price_buy;
	}

	@Column(name = "quantity")
	public float getQuantity() {
		return quantity;
	}

	public void setQuantity(float quantity) {
		this.quantity = quantity;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "pk.stock", cascade = CascadeType.ALL)
	public List<ServicesUses> getServicesUses() {
		return services;
	}

	public void setServicesUses(List<ServicesUses> services) {
		this.services = services;
	}

}
